<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<script type="text/javascript">
	function dealProcess(obj){
		if(obj != null){
			var processFlag=0;
			var id=obj.id;
			var curHtml=obj.innerHTML;
			if(obj.innerHTML=='已处理'){
				processFlag=0;
			}
			if(obj.innerHTML=='未处理'){
				processFlag=1;
			}
			$.ajax({
				type:'post',
				data:{id:id,processFlag:processFlag},
				url:'<%=basePath%>updateProcessFlagAction',
				success:function(data){
					if(data == 'true'){
						if(curHtml=='已处理'){
							$(obj).text('未处理');
							$(obj).css("color","red");
						}else{
							$(obj).text('已处理');
							$(obj).css("color","blue");
						}
					}else if(data == 'false'){
						alert(data);
					}
				}
			});
		}
		
		
	}
</script>

<c:if test="${code==1}">
	<form id="pagerForm" method="post" action="userFeedBack.action?toResult=searchFeedBack&rightId=${rightId}">
		<input type="hidden" name="pageNum" value="${page.currentPage }" /> 
		<input type="hidden" name="pageSize" value="${page.pageSize }" />
		<input type="hidden" name="id" value="${id}" />
		<input type="hidden" name="userId" value="${userId}" />
		<input type="hidden" name="userId" value="${username}" />
		<input type="hidden" name="userId" value="${mobile}" />
		<input type="hidden" name="opinion" value="${opinion}" />
		<input type="hidden" name="createTime" value="${createTime}" />
	</form>

	<form onsubmit="return navTabSearch(this);" action="userFeedBack.action?toResult=searchFeedBack&rightId=${rightId}" method="post">
		<div class="pageHeader">
			<input type="hidden" name="init" value=0>
			<div class="searchBar">
				<table class="searchContent">
					<tr>
						<td>
							用户ID: <input type="text" name="userId" value="${userId}" />
						</td>
						<td>
							用户姓名: <input type="text" name="username" value="${username}" />
						</td>
						<td>
							电话: <input type="text" name="mobile" value="${mobile}" />
						</td>
						
						<td>是否处理: 
							<select name="selectDealFlag" id="dealFlag">
							<option  value="0" <s:if test="#request.selectDealFlag==0">selected="selected"</s:if> >未处理</option>
							<option  value="1" <s:if test="#request.selectDealFlag==1">selected="selected"</s:if> >已处理</option>
							<option  value="2"<s:if test="#request.selectDealFlag==2">selected="selected"</s:if> >全部</option>	
							</select>
							
						</td>
						
						<td>
							<div class="buttonActive">
								<div class="buttonContent">
									<button type="submit">检索</button>
								</div>
							</div>
						</td>
					</tr>
				</table>
			</div>
		</div>
		

		<div class="pageContent">
			<div class="panelBar">
				<ul class="toolBar">
					<c:forEach items="${righSubtList}" var="rightsub">
						<!-- 添加  -->
<!--						<c:if test="${fn:contains(rightsub.rightValue,'addUser')}">
							<li><a class="add" href="${rightsub.rightValue}&rightId=${rightId}" target="navTab"><span>${rightsub.rightName}</span> </a>
							</li>
							<li class="line">line</li>
						</c:if>
						<!-- 修改  -->
						<c:if test="${fn:contains(rightsub.rightValue,'checkFeedBack')}">
							<li><a class="edit" href="${rightsub.rightValue}&supportID={sid_support}&rightId=${rightId}" target="navTab"><span>${rightsub.rightName}</span> </a>
							</li>
							<li class="line">line</li>
						</c:if>
						<!-- 删除 -->
<!--						<c:if test="${fn:contains(rightsub.rightValue,'deleteUser')}">
							<li><a class="delete" href="${rightsub.rightValue}&supportID={sid_support}&rightId=${rightId}" target="ajaxTodo" title="确认要删除吗？"><span>${rightsub.rightName}</span> </a>
							</li>
							<li class="line">line</li>
						</c:if>  -->
					</c:forEach>
				</ul>
			</div>

			
			<table class="list" width="100%" layoutH="138">
				<thead>
					<tr>
						<th align="center">序号</th>
						<th align="center">用户ID</th>
						<th align="center">用户姓名</th>
						<th align="center">电话</th>
						<th align="center">意见</th>
						<th align="center">是否处理</th>
						<th align="center">创建时间</th>
						<th align="center">处理记录</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator var="feedBackWithUser" value="page.data" status="st">
						<tr  target="sid_support" rel="<s:property value="#feedBackWithUser.id" />">
							<th width="1%" align="center"><s:property value="page.pageSize * (page.currentPage-1) + #st.index + 1" />
							</th>
							<th width="2%" align="center"><s:property value="#feedBackWithUser.userId" />
							</th>
							<th width="2%" align="center"><s:property value="#feedBackWithUser.username" />
							</th>
							<th width="2%" align="center"><s:property value="#feedBackWithUser.mobile" />
							</th>
							<th width="7%" align="left"><s:property value="#feedBackWithUser.opinion" />
							</th>
							<th width="2%" align="center">
								<s:if test="#feedBackWithUser.processFlag==0">
									<a id="<s:property value="#feedBackWithUser.id" />" href="javascript:void(0)" onclick="dealProcess(this)" style="color:red">未处理</a>
								</s:if>
								<s:elseif test="#feedBackWithUser.processFlag==1">
									<a id="<s:property value="#feedBackWithUser.id" />" href="javascript:void(0)" onclick="dealProcess(this)" style="color:blue">已处理</a>
								</s:elseif>
							
							</th>
							<th width="4%" align="center"><s:date name="#feedBackWithUser.createTime" format="yyyy-MM-dd hh:mm:dd"/>
							</th>
							<th width="7%" align="center"><s:property value="#feedBackWithUser.processRecord" />
							</th>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			<div class="panelBar">
				<div class="pages">
					<span>共${page.totalNum }条，共${page.totalPage }页</span>
				</div>
				<div class="pagination" targetType="navTab" totalCount="${page.totalNum }" numPerPage="${page.pageSize }" pageNumShown="10" currentPage="${page.currentPage }"></div>
			</div>
		</div>
	</form>
</c:if>
<c:if test="${code==0}">
	${message}
</c:if>